﻿using MediatR;
using T_Rbac.Read.APi.Application.Command.Rules;
using T_Rbac_Demain;
using T_Rbac_Rep.Interface;

namespace T_Rbac.Read.APi.Application.Handlers.RulesHandlers
{
    public class RuleReadAllHandler : IRequestHandler<RuleReadAllCommand, IQueryable<Rule>>
    {
        private readonly IRuleInformation ruleInformation;

        public RuleReadAllHandler(IRuleInformation ruleInformation)
        {
            this.ruleInformation = ruleInformation;
        }

        public async Task<IQueryable<Rule>> Handle(RuleReadAllCommand request, CancellationToken cancellationToken)
        {
            var list = await ruleInformation.GetvaluesByResult(x=>x.IsDel.Equals(false));
            return list;
        }
    }
}
